package com.livesource.client.web.sourceCode.viewOptions;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.PopupPanel;
import com.livesource.client.model.entry.ProjectClass;
import com.livesource.client.web.sourceCode.SourceCodePage;
import com.livesource.client.web.sourceCode.code.AceGWTEditor;

/**
 * 
 * @UserInterface
 */
public class ButtonSourceCode extends HTML {

	public static final String imageUnpressed = "<a href='#'><img src='"
			+ GWT.getModuleName() + "/liveSource/images/source.gif'></a>";

	public static final String imagePressed = "<a href='#'><img src='"
			+ GWT.getModuleName()
			+ "/liveSource/images/sourceHighlighted.gif'></a>";

	public PopupPanel sourceHint;

	public ButtonSourceCode(final ProjectClass entry) {

		this.setHTML(imageUnpressed);
		this.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {

				OptionsIcons.toggledButtons(entry);
				OptionsIcons.buttonSourceCode.setHTML(imagePressed);

				SourceCodePage.featureVisualizationPanel.clear();

				new AceGWTEditor().showCodeEditor(entry);
			}
		});

		/*
		 * sourceHint = HelpHint.getHelpHintLinked(this.getClass().getName(),
		 * internationalizationConstants.source(), GlobalVariables.locale);
		 * 
		 * this.addMouseOverHandler(new MouseOverHandler() {
		 * 
		 * @Override public void onMouseOver(MouseOverEvent event) {
		 * 
		 * OptionsIcons.hideHints();
		 * 
		 * HelpHint.executeMouseOverHandler(event, sourceHint, null);
		 * 
		 * } });
		 */
	}
}
